using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class Bomb : MonoBehaviour
{
    private Animator m_Animator;

    public float force = 10;
    #region Unity方法
    private void Awake()
    {
        m_Animator = GetComponent<Animator>();
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        m_Animator.SetTrigger("Boom");
        Vector2 distance = (collision.transform.position - transform.position).normalized;
        collision.gameObject.GetComponent<Rigidbody2D>().velocity = distance * force;
    }
    #endregion
}
